package day8;

/**
 * @author oldliu
 * @since 1.0
 */
public class Thread3 {
    public static void main(String[] args) {
        //主线程等待子线程结束，再输出  “打印结束了”
        System.out.println("主线程开始");
        Thread th[]=new Thread[4];
        for(int i=1;i<=4;i++){
            th[i-1]=new PrintThread("线程"+i);

            th[i-1].start();
        }
        for(Thread t:th) {
            try {
                t.join();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

        System.out.println("打印结束了");
    }
}
